<?php
/**
 * Junction_Class_Field
 * 
 * Models class's field.
 * 
 * @author Patrick J. Mizer <patrick.mizer@gmail.com>
 */
 
using("Junction_Sql_Writable");
using("Junction_Class_Class");
using("Junction_Sql_Column");

class Junction_Class_Field implements Junction_Sql_Writable
{
	/**
	 * Field's name
	 * 
	 * @var string
	 */
	private $_fieldName;
	
	/**
	 * Field's column
	 * 
	 * @var Junction_Sql_Column
	 */
	private $_column;
	
	/**
	 * Field's class
	 * 
	 * @var Junction_Class_Class
	 */
	private $_class;
	
	/**
	 * Junction_Class_Field Constructor
	 * 
	 * @param string name
	 * @param Junction_Sql_Column
	 * @param Junction_Class_Class
	 */
    public function __construct($fieldName, 
    	Junction_Sql_Column $column, Junction_Class_Class $class) 
    {
    	$this->_fieldName 	= $fieldName;
    	$this->_column 		= $column;
    	$this->_class 		= $class;    	
    }
    
    /**
     * Gets SQL represnation of field.
     * 
     * @return string
     */
    public function getSqlString()
    {
    	return Junction_Sql_Utilities::addTicks($this->_column->getTable()->getName()) . 
			'.' . Junction_Sql_Utilities::addTicks($this->_column->getName());
    }
}
?>